package com.obrock;

/**
 * Created with IntelliJ IDEA.
 * User: Дмитрий Г. Кузнецов
 * Date: 18.09.12
 * Time: 10:48
 * To change this template use File | Settings | File Templates.
 */

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TextView;

/**
 *
 * @author Rick
 */
public class EditAuthentication extends Activity {

    EditText login;
    EditText password;
    TextView title;
    Button btnOK;

    TableLayout blockHeader;


    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.edit_authentication);

        title = (TextView) findViewById(R.id.title);
        login = (EditText) findViewById(R.id.login);
        password = (EditText) findViewById(R.id.password);
        btnOK = (Button) findViewById(R.id.btnOk);
        blockHeader = (TableLayout) findViewById(R.id.block_header);

        btnOK.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.putExtra("login", login.getText().toString());
                intent.putExtra("password", password.getText().toString());
                setResult(RESULT_OK, intent);
                finish();
            }
        });
        //Button btnCancel = (Button) findViewById(R.id.btnCancel);
        //btnCancel.setOnClickListener(this);

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            title.setText((extras.getString("title")));
        }

        /*
        login.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                if(b) {
                    blockHeader.setVisibility(View.GONE);
                } else {
                    blockHeader.setVisibility(View.VISIBLE);
                }
            }
        });
        password.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                if(b) {
                    blockHeader.setVisibility(View.GONE);
                } else {
                    blockHeader.setVisibility(View.VISIBLE);
                }
            }
        });
        */

    }

    @Override
    public void onBackPressed() {
        return;
    }

}
